<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>点击</button>
    <button>点击</button>
    <button>点击</button>
    <script>
        // 获取要绑定时间的元素对象
        var btn = document.querySelector('button');
        // 绑定事件
        btn.onclick = function(){
            alert('按钮被点击了');
        };
    </script>
</body>
</html>